Cover TOC Chap Prev Chap Prev Fig Next Fig Next Chap

Chapter 9: Sensing Viewer Actions

../ch09/09fig04.gif
Figure 9.4

A cube that translates within a limited range of the XZ plane when the viewer drags it.

09fig04.wrl
Click on the image to view the VRML scene.

#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
    children [
        Transform {
            rotation 1.0 0.0 0.0 -1.57
            children DEF Cube Transform {
                children Shape {
                    appearance Appearance {
                        material Material { }
                    }
                    geometry Box { }
                }
            }
        },
        DEF Sensor PlaneSensor {
            minPosition -2.0 -2.0
            maxPosition  2.0  2.0
        }
    ]
}
ROUTE Sensor.translation_changed TO Cube.set_translation